#pragma once

#include <stdint.h>
#include <stdio.h>
#include "thread_job.h"
#include <boost/function.hpp>
#include <boost/threadpool.hpp>

class thread_manager
{
	public:
		thread_manager(void);
		thread_manager( uint32_t num_threads_start );
		~thread_manager(void);

		void addShortJob( thread_job &job ) { short_jobs->schedule( job ); }
		void addLongJob( thread_job &job ) { long_jobs->schedule( job ); }

		void print() { update_totals(); printf( "Total Allowed Jobs: %d\nTotal Running Jobs: %d\n", total_jobs, total_running_jobs ); }

	private:
		void update_totals() { total_jobs = short_jobs->size() + long_jobs->size(); total_running_jobs = short_jobs->active() + long_jobs->active(); }

		boost::threadpool::thread_pool<thread_job> *short_jobs;

		boost::threadpool::thread_pool<thread_job> *long_jobs;

		uint32_t total_jobs;
		uint32_t total_running_jobs;
};

